const { sequelize } = require('./index')
const { Model, DataTypes } = require('sequelize')

class User extends Model {
  static someStaticMethod() {
    console.log('someStaticMethod')
  }
  someInstanceMethod() {
    console.log('someInstanceMethod')
  }
}

User.init({
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true,
  },
  name: {
    type: DataTypes.STRING,
  },
  mobile: {
    type: DataTypes.STRING(11),
  },
  age: {
    type: DataTypes.TINYINT,
    defaultValue: 0,
  },
}, {
  sequelize,
  // modelName: User.name,
  // freezeTableName: true,
  tableName: 't_user',
  createdAt: 'ctime',
  updatedAt: 'utime',
})

module.exports = {
  User,
}
